/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sahd.server.services.client;

import sahd.beans.UserBean;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 *
 * @author Administrator
 */
@WebService()
public class ClientManager {
/**
    private UserDAO userDao;


    public ClientManager(){
        userDao=new UserDAO();
    }


    @WebMethod(operationName = "registerClient")
    public boolean registerClient(@WebParam(name = "userBean")
    final UserBean userBean) throws DAOException {
        if(alreadyExists(userBean)) return false;
        userDao.insert(userBean);
        return true;
    }

    @WebMethod(operationName = "updateClient")
    public boolean updateClient(@WebParam(name = "userBean")
    final UserBean userBean) throws DAOException {

        if(alreadyExists(userBean)==false) return false;
        String condition="userId = " + userBean.getUserId();
        userDao.modify(userBean, condition);
        return true;
    }

    private boolean alreadyExists(UserBean userBean) throws DAOException{
        String condition = "userAccountName= "+ userBean.getUserAccountName();
        condition = condition + " userAccountPassword= " + userBean.getUserAccountPassword();
        userDao.search(condition);
        return false;
    }

    


**/
}
